package com.kuang.springcloud.service;


import com.kuang.springcloud.pojo.Userinfo;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class DeptClientServiceFallBackFactory implements FallbackFactory<UserClientService>{

    @Override
    public UserClientService create(Throwable throwable) {
        return new UserClientService() {
            @Override
            public List<Userinfo> findAll() {
                return null;
            }

            @Override
            public Userinfo getuserByUsername(String username) {
                Userinfo userinfo = new Userinfo();
                userinfo.setUsername(username+"没这个人，@Hystrix,这是服务降级");
                return userinfo;
            }


        };
}
}
